<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box">
        <p>666</p>
    </div>


</body>

</html>
<script>
    //document.getElementById("box")
    var box = document.querySelector("#box");
    //获取标签中包含html的内容 对象.innerHTML
    //console.log(box.innerHTML);

    //设置标签中包含html的内容 对象.innerHTML=值;
    // box.innerHTML = "<h1>你好，世界</h1>";

    //box.innerText 获取或设置标签中的文字  不支持标签
    console.log(box.innerText);
    box.innerText = "<h1>你好，世界</h1>";




</script>